import request from '@/router/axios';

// 分页查询活动数据
export const getList = (current, size, params) => {
    return request({
        url: '/api/mes-admin/activity/page',
        method: 'get',
        params: {
            ...params,
            current,
            size
        }
    });
};

export const getDetail = (id) => {
    return request({
        url: '/api/mes-admin/activity/detail',
        method: 'get',
        params: {
            id
        }
    });
};

export const remove = (ids) => {
    return request({
        url: '/api/mes-admin/activity/remove',
        method: 'post',
        params: {
            ids
        }
    });
};

export const addOrUpdate = (row) => {
    return request({
        url: '/api/mes-admin/activity/submit',
        method: 'post',
        data: row
    });
};

// 分页查询活动关联的规则
export const getActivityRules = (activityId) => {
    return request({
        url: '/api/mes-admin/activity/pageCheckItems',
        method: 'get',
        params: {
            activityId
        }
    });
};

// 添加关联规则
export const addRulesData = (params) => {
    return request({
        url: '/api/mes-admin/activity/submitCheckItems',
        method: 'post',
        data: params
    });
};
